#include <csignal>

#include "runtime/reactor.h"
#include "util/logger.h"

using namespace kawauso;
using namespace std;

static void handleExitSignal(int) {
    Reactor::global.stop();
}

int main(int, char **) {

    try {
        Reactor::global.init();
    } catch (exception &e) {
        error("{}", e.what());
        return EXIT_FAILURE;
    }

    signal(SIGINT, handleExitSignal);
    signal(SIGTERM, handleExitSignal);

    Reactor::global.start();

    return EXIT_SUCCESS;
}
